package com.bosssoft.hr.train.j2se.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.Objects;
/**
 * @Classname: Role
 * @Description:
 * @author: zoubinyan
 * @Date: 2023/2/22
 */


@Data
@AllArgsConstructor
@NoArgsConstructor
public class Role extends BaseEntity {
    /**
     *  姓名
     */
    private String name;
    /**
     *  角色代码 一般是不重复
     */
    private String code;

    public Role(Long id,String code,String name) {
        this.id = id;
        this.name = name;
        this.code = code;
    }

    public Role(Long id,
                String remark,
                Long tenantId,
                Long orgId,
                Long companyId,
                Long createdBy,
                String creator,
                Date createdTime,
                Long updatedBy,
                Date updatedTime,
                String modifier,
                byte status,
                Long version,
                String name,
                String code) {
        super(id, remark, tenantId, orgId, companyId, createdBy, creator, createdTime, updatedBy, updatedTime, modifier, status, version);
        this.name = name;
        this.code = code;
    }

    @Override
    public boolean equals(Object r) {
        if (this == r) {return true;}
        if (r == null || getClass() != r.getClass()) {return false;}
        if (!super.equals(r)) {return false;}
        Role role = (Role) r;
        return Objects.equals(name, role.name) && Objects.equals(code, role.code) && Objects.equals(id,role.id);
    }


    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), code, name, id);
    }

    @Override
    public String toString() {
        return "Role{" +
                "name='" + name + '\'' +
                ", code='" + code + '\'' +
                ", id=" + id +
                '}';
    }
}
